import httpRequest from '@/config/axios/httpRequest'
import {
  CreateDeptReq,
  CreateDeptResp,
  DeleteDeptReq,
  DeleteDeptResp,
  QueryDeptDetailReq,
  QueryDeptDetailResp,
  QueryDeptPageReq,
  QueryDeptPageResp,
  UpdateDeptReq,
  UpdateDeptResp
} from '@/models/base/DepartmentModel'
import baseapi from '@/api/declaration/baseApi'

// 查询部门列表
export const getDeptPage = async (params: QueryDeptPageReq) => {
  return await httpRequest.get<QueryDeptPageResp>(baseapi.QueryDeptPage, { params })
}

// 查询部门详情
export const getDept = async (params: QueryDeptDetailReq) => {
  return await httpRequest.get<QueryDeptDetailResp>(baseapi.QueryDeptDetail, { params })
}

// 新增部门
export const createDept = async (data: CreateDeptReq) => {
  return await httpRequest.post<CreateDeptResp>(baseapi.CreateDept, data)
}

// 修改部门
export const updateDept = async (params: UpdateDeptReq) => {
  return await httpRequest.post<UpdateDeptResp>(baseapi.UpdateDept, params)
}

// 删除部门
export const deleteDept = async (params: DeleteDeptReq) => {
  return await httpRequest.delete<DeleteDeptResp>(baseapi.DeleteDept, { params })
}
